package com.sxz.sbs.module.staff.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.sxz.sbs.R;
import com.sxz.sbs.entity.AuthorityEntity;

import java.util.List;

/**
 * 员工管理适配器
 */

public class StaffMangerAdapter extends BaseQuickAdapter<AuthorityEntity,BaseViewHolder>{
    public StaffMangerAdapter(@Nullable List<AuthorityEntity> data) {
        super(R.layout.item_staff_manger_layout,data);
    }

    @Override
    protected void convert(BaseViewHolder helper, AuthorityEntity item) {
        helper.setText(R.id.tv_staff_manger,item.getTxt_Name());
        helper.setImageResource(R.id.iv_staff_manger,getDrawableId(item.getIc_Path()));
    }
    private int getDrawableId (String name) {
        try {
            return mContext.getResources().getIdentifier(name, "drawable", mContext.getPackageName());
        }catch (Exception e) {

        }
        return 0;
    }
}
